package teamBattledal

import (
	"fmt"

	"7qule.com/sd3/CrossServer/src/common/onlinelog"
	"7qule.com/sd3/CrossServer/src/dal"
)

// 获取战斗节点Id列表
func GetBattleNodeIdList() ([]int32, error) {
	cmd := "SELECT ID from b_expedition_node_model"
	rows, err := dal.GetGameModelDB().Raw(cmd).Rows()
	if err != nil {
		onlinelog.ErrorLog(fmt.Sprintf("%v失败,错误信息:%v", cmd, err))
		return nil, err
	}
	defer rows.Close()

	result := make([]int32, 0)
	for rows.Next() {
		var val int32
		if err = rows.Scan(&val); err != nil {
			onlinelog.ErrorLog(fmt.Sprintf("%v scan失败,错误信息:%v", cmd, err))
			return nil, err
		}

		result = append(result, val)
	}

	return result, nil
}
